package com.xjy.headfirst.工厂模式;

import lombok.Data;

/**
 * @author :辛纪元
 * @description: pizza生成类
 * @since :2022-06-13 19:37
 */

@Data
public abstract class PizzaStore {


    protected Pizza orderPizza(int type) {
        Pizza pizza = createPizza(type);
        pizza.prepare();
        pizza.over();
        return pizza;
    }

    /**
     * 子类实现
     *
     * @param type 根据type创建pizza
     * @return Pizza
     */
    protected abstract Pizza createPizza(int type);
}
